<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function feibo(n) {
            // 解法二：动态规划
            if (n <= 1) return n
            // 初始化dp
            let dp = []
            dp[0] = 0
            dp[1] = 1
            for (let i = 2; i <= n; i++) {
                // 确定递推公式和遍历顺序
                dp[i] = dp[i - 1] + dp[i - 2]
            }
            return dp[n]
        }
        console.log(feibo(10), 'dp');
    </script>
</body>
</html>